package StringUtils;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class TestServcie {

	public static void main(String[] args) throws Exception {
		ServerSocket serverSocket = null;
		Socket socket = null;
		PrintWriter print = null;

		try {
			serverSocket = new ServerSocket(8888);
			socket = serverSocket.accept();
			System.out.println(socket.getInetAddress());
			print = new PrintWriter(new OutputStreamWriter(socket
					.getOutputStream()));
			print.println("abc");
			print.flush();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				serverSocket.close();
			} catch (IOException e) {
				e.printStackTrace();
			}

		}

	}
}
